<template>
	<view class="bank-wrap">
		<view class="form-box">
			<label>
				<view class="form-item flex align-center justify-between">
					<view class="item-title">交易密码:</view>
					<input class="item-input flex-sub" password  type="text" v-model="tradepass" maxlength="11" placeholder="请输入6位数字的密码" placeholder-class="pl-input" />
				</view>
			</label>
			<label>
				<view class="form-item flex align-center justify-between">
					<view class="item-title">确认密码:</view>
					<input class="item-input flex-sub" password type="text" v-model="quepass" placeholder="请再次输入密码" placeholder-class="pl-input" />
				</view>
			</label>
		</view>
		<view class="btn-box flex align-center justify-center"><button class="cu-btn confirem-btn" @tap="editPassword">提交</button></view>
	</view>
</template>

<script>
export default {
	components: {},
	data() {
		return {
			tradepass: '',
			quepass: ''
		};
	},
	computed: {},
	onLoad() {},
	methods: {
		//设置密码
		editPassword() {
			let that = this;
			var reg = new RegExp(/^\d{6}$/);
			if (!reg.test(that.tradepass)) {
				that.$msg('请设置6位纯数字的交易密码');
				return false;
			}
			if (that.tradepass != that.quepass) {
				that.$msg('新密码不一致');
				return false;
			}
			var data = { pay_pwd: that.tradepass, comfirm_pay_pwd: that.quepass,};
			that.$api.setpaypwd(data).then(res => {
				that.$msg(res.msg)
				if (res.code == 1) {
					setTimeout(function(){
						uni.navigateBack();
					},800)
				}
			});
		}
	}
};
</script>

<style lang="scss">
.form-box {
	background: #fff;
	.form-item {
		height: 96rpx;
		border-bottom: 1rpx solid rgba(#dfdfdf, 0.9);
		padding: 0 25rpx;
		.item-title {
			color: #333;
			font-size: 28rpx;
			font-weight: 600;
		}
		.item-input {
			font-size: 28rpx;
			color: #333;
			padding-left: 20rpx;
		}
		.pl-input {
			color: #999;
		}
	}
}
.notice {
	color: #999;
	font-size: 24rpx;
	padding: 0 25rpx;
	height: 90rpx;
}
.btn-box {
	margin-top: 60rpx;
	.confirem-btn {
		width: 710rpx;
		height: 80rpx;
		background: $zhuse;
		// border: 1rpx solid rgba(238, 238, 238, 1);
		border-radius: 40rpx;
		font-size: 30rpx;
		color: rgba(#fff, 0.9);
	}
}
</style>
